package NGUYENMINHHIEU.GENERICS.SAMPLE01;

public class TringleControllers implements IGeometricObjects {

    @Override
    public double Area(Object obj) {
        TringleEntity objTringle = (TringleEntity) obj;
        double p = (objTringle.getSide01() + objTringle.getSide02() + objTringle.getSide03()) / 2;
        return Math
                .sqrt(p * (p - objTringle.getSide01()) * (p - objTringle.getSide02()) * (p - objTringle.getSide03()));
    }

    @Override
    public double Perrimeter(Object obj) {
        TringleEntity objTringle = (TringleEntity) obj;
        return objTringle.getSide01() + objTringle.getSide02() + objTringle.getSide03();
    }
}
